<template>
	<view v-if="isShow">
		<u-modal :show="isShow" title="提示" :content="content" confirmColor="#000000"
			@confirm="stackLength?$toBack():$switchTab('/pages/index/index')"></u-modal>
	</view>
</template>
<script>
	export default {
		name: "data-null",
		data() {
			return {
				isShow: false,
				content: '当前数据不存在',
				stackLength: false
			};
		},
		// 此处定义传入的参数
		props: {},
		watch: {},
		mounted() {
			// #ifdef MP-WEIXIN
			const pages = getCurrentPages();
			const stackLength = pages.length;

			if (stackLength > 1) {
				// 存在上一页
				this.stackLength = true
			} else {
				// 不存在上一页
				this.stackLength = false
			}
			// #endif
		},
		methods: {
			// 显示弹框
			show(msg) {
				this.isShow = true;
				this.content = msg;
			}
		},
	}
</script>
<style lang="scss">
</style>